cleanup various debug items,
authorjames_sherring <james_sherring@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 5 Dec 2003 11:24:29 +0000 (11:24 +0000)
committerjames_sherring <james_sherring@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 5 Dec 2003 11:24:29 +0000 (11:24 +0000)
no input file condition bug fix

12 files changed:
st2gpx/src/annotations.c
st2gpx/src/contents.c
st2gpx/src/debug.c
st2gpx/src/journey.c
st2gpx/src/ppinutil.c
st2gpx/src/properties.c
st2gpx/src/readgpx.c
st2gpx/src/st2gpx.c
st2gpx/src/st2gpx.dsp
st2gpx/src/st2gpx.h
st2gpx/src/writegpx.c
st2gpx/src/writepcx.c

index c3a3f5197536dd746b62c584b306118b17ba1222..e737ba805db04352032d0337fca9e2c7388e01d9 100644 (file)
@@ -61,19 +61,19 @@ char std_annot_linerec_header_v4[LINE_REC_LEN_V4] =
 //   type                   annot#1               ,\r
        {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // 0x00\r
 \r
-        0x00, 0x00, 0x00, 0x00, \r
+        0x00, 0x00, 0x00, 0x00,\r
 \r
 //show length,\r
 //   order\r
 //behind roads\r
-        0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
-        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
-        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
+        0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r
 //   blue                     2pt\r
-        0x12, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, \r
+        0x12, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,\r
 //                         show line\r
-        0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, \r
-        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
+        0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,\r
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r
         0x00};\r
 \r
 //struct parameters {\r
@@ -131,9 +131,9 @@ void annot_rec_delete(struct annot_rec * annot_rec)
        if (annot_rec==NULL)\r
                return;\r
        //for(i=0; i<annot_rec->line_points)\r
-       xfree(annot_rec->buf);\r
-       xfree(annot_rec->text);\r
-       xfree(annot_rec);\r
+       free(annot_rec->buf);\r
+       free(annot_rec->text);\r
+       free(annot_rec);\r
 }\r
 \r
 struct annotations * annotations_new()\r
@@ -159,9 +159,9 @@ void annotations_delete(struct annotations * annots)
 \r
        for (i=0; i<annots->num_annotations; i++)\r
                annot_rec_delete(annots->annot_list[i]);\r
-       xfree(annots->annot_list);\r
-       xfree(annots->header_buf);\r
-       xfree(annots);\r
+       free(annots->annot_list);\r
+       free(annots->header_buf);\r
+       free(annots);\r
 }\r
 \r
 struct gpxpt* gpx_get_point(char* buf)\r
@@ -276,12 +276,12 @@ struct annot_rec * read_annot_rec(FILE* annot_in_file, int version)
                }\r
        }\r
 \r
-       if (rec->type == ANNOT_TYPE_LINE) \r
+       if (rec->type == ANNOT_TYPE_LINE)\r
                rec->line_offset = line_offset;\r
 \r
        if (rec->type<4)\r
                rec_type =annot_type_name[rec->type];\r
-       else \r
+       else\r
                rec_type=NULL;\r
 \r
        if (opts.verbose_flag > 4)\r
@@ -383,9 +383,8 @@ struct annotations * process_annotations_stream(char* annot_in_file_name)
        {\r
            rec = read_annot_rec(annot_in_file, annots->version);\r
 \r
-               // current version of explore annots is a bit childish\r
-//             if (opts.explore_flag)\r
-//                     explore_annot(rec);\r
+               if (opts.explore_flag)\r
+                       explore_annot(rec);\r
                if (rec==NULL)\r
                {\r
                        annots->read_recs_ok_flag = 0;\r
@@ -412,7 +411,7 @@ struct annotations * process_annotations_stream(char* annot_in_file_name)
                }\r
                else\r
                        annots->read_tail_ok_flag=1;\r
-               xfree(checkEOF);\r
+               free(checkEOF);\r
        }\r
        fclose(annot_in_file);\r
        return annots;\r
index ee6bf4aecea4adcd4a4e723e9b2943a1854689c9..513420f343c84b8caa162ae0e6f3515c2e1cc69c 100644 (file)
@@ -71,10 +71,13 @@ struct contents * contents_new()
 \r
 void contents_delete(struct contents * conts)\r
 {\r
-       xfree(conts->list_f_pcbtext);\r
-       xfree(conts->list_f_text);\r
-       xfree(conts->buf);\r
-       xfree(conts);\r
+       if(conts != NULL)\r
+       {\r
+               free(conts->list_f_pcbtext);\r
+               free(conts->list_f_text);\r
+               free(conts->buf);\r
+       }\r
+       free(conts);\r
 }\r
 \r
 void print_f_contents0(struct f_contents0 * conts)\r
@@ -217,17 +220,17 @@ struct contents * parse_contents_buffer(char* buf, unsigned int buf_len)
                        printf("Array[%d]=%d - unknown meaning\n", i, conts->f_conts_array[i]);\r
 \r
                printf("n:=Array[3]=%d is number of user pushpin sets\n", (conts->f_conts_array)[3]);\r
-               \r
+\r
 //             for(i=0; i< (conts->f_conts_array[3]); i++)\r
-//                     printf("Array[%d]=%d is SetId for user PushpinSet[%d] \n", \r
+//                     printf("Array[%d]=%d is SetId for user PushpinSet[%d] \n",\r
 //                                     4+i,\r
 //                                     conts->f_conts_array[4+i],\r
-//                                     conts->f_conts_array[3] - i -1);        \r
+//                                     conts->f_conts_array[3] - i -1);\r
 \r
                for(i=0; i< (conts->f_conts_array[3]); i++)\r
                        printf("Array[4+n-(%d)]=%d is SetId for user PushpinSet[%d]\n",\r
                                        i, conts->f_conts_array[3+(conts->f_conts_array[3])-i], i);\r
-               \r
+\r
                for(i=0; (4 + (conts->f_conts_array[3] +i)) < (conts->f_conts0->array_len)/2 ; i++)\r
                        printf("Array[5+n+(%d)]=%d - unknown meaning\n",\r
                                        i, conts->f_conts_array[4+(conts->f_conts_array[3])+i]);\r
@@ -235,7 +238,7 @@ struct contents * parse_contents_buffer(char* buf, unsigned int buf_len)
                debug_pause();\r
 \r
 //             printf("Dumping Contents array tail:\n");\r
-//             printbuf((char*)(conts->f_conts_array + 4 + conts->f_conts_array[3]), \r
+//             printbuf((char*)(conts->f_conts_array + 4 + conts->f_conts_array[3]),\r
 //                              (conts->f_conts0->array_len)-2*(4 + conts->f_conts_array[3])  );\r
        }\r
 \r
@@ -263,7 +266,7 @@ struct contents * parse_contents_buffer(char* buf, unsigned int buf_len)
        {\r
                temp_str=buf2str(conts->f_text0, *(conts->f_pcbtext0));\r
                printf("Got Text0='%s'\n", temp_str);\r
-               xfree(temp_str);\r
+               free(temp_str);\r
                temp_str=NULL;\r
        }\r
 \r
@@ -296,7 +299,7 @@ struct contents * parse_contents_buffer(char* buf, unsigned int buf_len)
        {\r
                temp_str=buf2str(conts->f_text1, conts->f_conts1->cbText1);\r
                printf("Got Text1='%s'\n", temp_str);\r
-               xfree(temp_str);\r
+               free(temp_str);\r
                temp_str=NULL;\r
        }\r
 \r
@@ -347,7 +350,7 @@ struct contents * parse_contents_buffer(char* buf, unsigned int buf_len)
                {\r
                        temp_str = buf2str(conts->list_f_text[i], *(conts->list_f_pcbtext[i]));\r
                        printf("Got list_text[%d]='%s'\n", i, temp_str);\r
-                       xfree(temp_str);\r
+                       free(temp_str);\r
                }\r
        }\r
 \r
@@ -356,7 +359,7 @@ struct contents * parse_contents_buffer(char* buf, unsigned int buf_len)
        // **************************\r
 \r
     conts->pusunkn0 = (unsigned short*)(conts->buf+buf_pos);\r
-       \r
+\r
        buf_pos += sizeof(unsigned short);\r
        if (buf_pos>(conts->buf_len))\r
        {\r
@@ -409,7 +412,7 @@ struct contents * parse_contents_buffer(char* buf, unsigned int buf_len)
                temp_str=buf2str(conts->CountryText, conts->f_conts3->cbCountryText);\r
                if(opts.explore_flag)\r
                printf("Got CountryText='%s'\n", temp_str);\r
-               xfree(temp_str);\r
+               free(temp_str);\r
                temp_str=NULL;\r
        }\r
 \r
@@ -417,7 +420,7 @@ struct contents * parse_contents_buffer(char* buf, unsigned int buf_len)
                conts->fully_parsed_flag=1;\r
        else\r
        {\r
-               printf("Unexpected %d bytes of contents buffer still remaining.\n", \r
+               printf("Unexpected %d bytes of contents buffer still remaining.\n",\r
                                (conts->buf_len)-buf_pos);\r
                printbuf((conts->buf)+buf_pos, (conts->buf_len)-buf_pos);\r
        }\r
index e1cf06f5a84c39418196e24e7352e9002f0dec72..675338d0b3a4c93536c57411752d0e0ecbea3511 100644 (file)
@@ -50,23 +50,8 @@ void debug_pause()
        }\r
 }\r
 \r
-int fixhex(char c)\r
-{\r
-// gcc (version?) does not print single byte hex values properly\r
-// eg 0xe3 prints as 0xFFFFFFE3\r
-// this is only a problem for values above 0x80\r
-// Or maybe that is the proper handling of unsigned?\r
-// Aaaahhh. I should use %u for printing unsigned... but the hex problem is still there\r
-       if(c & 0x80)\r
-       {\r
-               return ((int)c-0xFFFFFF00);\r
-       } else\r
-               return c;\r
-}\r
-\r
 void printbuf(char* buf, int len)\r
 {\r
-//     unsigned i;\r
        int i;\r
        printf("     0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F\n");\r
        printf("    -----------------------------------------------");\r
@@ -74,59 +59,7 @@ void printbuf(char* buf, int len)
        {\r
                if (((i+1) & 0x0f) == 0x1)\r
                        printf("\n%2x| ",i/16);\r
-               printf("%2x ",fixhex(buf[i]));\r
-       }\r
-       printf("\n\n");\r
-}\r
-\r
-void printbufwide(char* buf, int len)\r
-{\r
-       int i;\r
-       for(i=0; i<len; i++)\r
-       {\r
-               printf("%2x ",fixhex(buf[i]));\r
-       }\r
-       printf("\n\n");\r
-}\r
-\r
-void printbufhigh(char* buf, int len)\r
-{\r
-       int i;\r
-       for(i=0; i<len; i++)\r
-       {\r
-               printf("%02x %02x\n", i, fixhex(buf[i]));\r
-       }\r
-       printf("\n\n");\r
-}\r
-\r
-void printbufasfloat(char* buf, int len)\r
-{\r
-//     unsigned i;\r
-       int i;\r
-//     printf("     0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F\n");\r
-//     printf("    -----------------------------------------------");\r
-       for(i=0; i<len-3; i++)\r
-       {\r
-               if (((i+1) & 0x03) == 0x1)\r
-                       printf("\n%2x| ",i);\r
-               printf("%f  ", *(float*)(buf+i));\r
-               fflush(stdout);\r
-       }\r
-       printf("\n\n");\r
-}\r
-\r
-void printfloatbuf(float* fbuf, int len)\r
-{\r
-//     unsigned i;\r
-       int i;\r
-//     printf("     0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F\n");\r
-//     printf("    -----------------------------------------------");\r
-       for(i=0; i<len; i++)\r
-       {\r
-               if (((i+1) & 0x03) == 0x1)\r
-                       printf("\n%2x| ",4*i);\r
-               printf("%f  ", fbuf[i]);\r
-               fflush(stdout);\r
+               printf("%2x ", (unsigned char)buf[i]);\r
        }\r
        printf("\n\n");\r
 }\r
@@ -134,7 +67,6 @@ void printfloatbuf(float* fbuf, int len)
 void printpoints(char* buf, int numpts)\r
 {\r
        int i;\r
-//     int j;\r
        struct gpxpt* pt;\r
        printf("Latitude  Longitude Height");\r
        printf("\n");\r
@@ -148,100 +80,8 @@ void printpoints(char* buf, int numpts)
        printf("\n\n");\r
 }\r
 \r
-void printpointsbuf(char* buf, int len)\r
-{\r
-//     unsigned i;\r
-//     unsigned j;\r
-       int i;\r
-       int j;\r
-       printf("     0  1  2  3  4  5  6  7  8  9  A  B\n");\r
-       printf("    -----------------------------------");\r
-       for(i=0; i<len; i++)\r
-       {\r
-               printf("\n%2x| ",i);\r
-       //      printf("\n");\r
-               for (j=0; j<12; j++)\r
-               {\r
-                       printf("%2x ",fixhex(buf[12*i+j]));\r
-                       fflush(stdout);\r
-               }\r
-       }\r
-       printf("\n\n");\r
-}\r
-\r
-void printbufaspoints(char* buf, int buflen)\r
-{\r
-       int i;\r
-//     int j;\r
-       struct gpxpt * pt;\r
-       printf("Latitude  Longitude Height");\r
-       printf("\n");\r
-       printf("--------------------------\n");\r
-       for(i=0; i<buflen-11; i++)\r
-       {\r
-               pt = gpx_get_point(buf + 12*i);\r
-               printf("%#02x %f N %f E %f m \n", i, pt->lat, pt->lon, pt->elevation);\r
-               gpxpt_delete(pt);\r
-               fflush(stdout);\r
-       }\r
-       printf("\n\n");\r
-}\r
-\r
-void printnzbuf(char* buf, int len)\r
-{\r
-// print non-zero values in the buffer\r
-//     unsigned i;\r
-       int i;\r
-       for(i=0; i<len; i++)\r
-       {\r
-//             if (buf[i] != 0) printf("Buf[%x]=%2x ",fixhex(i), fixhex(buf[i]));\r
-               if (buf[i] != 0) printf("Buf[%x]=%2x ",i, fixhex(buf[i]));\r
-       }\r
-       printf("\n");\r
-}\r
-\r
-//void printnzhead(struct annot_rec rec)\r
-//{\r
-//     printnzbuf(rec.buf, annot_head_len[rec.type]);\r
-//}\r
-\r
 void explore_annot(struct annot_rec * rec)\r
 {\r
-       char* header;\r
-       char* tail;\r
-       int taillength;\r
-\r
-       header = (char*)xmalloc(ANNOT_REC_HEAD_LEN);\r
-       memcpy(header, rec->buf, ANNOT_RECOS_TEXT);\r
-       memcpy(header+ANNOT_RECOS_TEXT+2*rec->text_length, rec->buf,\r
-               ANNOT_REC_HEAD_LEN-ANNOT_RECOS_TEXT);\r
-\r
-       tail = rec->buf+ANNOT_REC_HEAD_LEN+2*rec->text_length;\r
-       taillength = rec->length - ANNOT_REC_HEAD_LEN+2*rec->text_length;\r
-\r
-       printf("Record buffer\n", annot_type_name[rec->type]);\r
-       printbuf(rec->buf, rec->length);\r
-       printf("Record high buffer\n", annot_type_name[rec->type]);\r
-       printbufhigh(rec->buf, rec->length);\r
-       printf("Record wide header:\n", annot_type_name[rec->type]);\r
-       printbufwide(header, ANNOT_REC_HEAD_LEN);\r
-       printf("Record tail:\n");\r
-       printbuf(tail, taillength);\r
-       printf("Record wide tail:\n");\r
-       printbufwide(tail, taillength);\r
-       printf("Record tail as floats:\n");\r
-       printbufasfloat(tail, taillength);\r
-       printf("Record tail as points:\n");\r
-       printbufaspoints(tail, taillength);\r
-//     if (rec->type == ANNOT_TYPE_TEXT)\r
-//     {\r
-               //printfloatbuf((float*)(tail+3), taillength/4 -1);\r
-//     }\r
-//     else if (rec->type == ANNOT_TYPE_OVAL )\r
-//             printfloatbuf((float*)(tail+3), taillength/4 -1);\r
-//     else if (rec->type == ANNOT_TYPE_CIRCLE ))\r
-//             printfloatbuf((float*)(tail+3), taillength/4 -1);\r
-       xfree(header);\r
 }\r
 \r
 void print_f_jour_header(struct f_jour_header * head)\r
@@ -266,17 +106,17 @@ void print_f_jour_pt_head(struct f_jour_pt_head * pt_head)
        printf("iunkn0 %#x=%d\n", pt_head->iunkn0, pt_head->iunkn0);\r
        printf("sched_arrive_flag %d\n", pt_head->sched_arrive_flag);\r
        printf("sched_depart_flag %d\n", pt_head->sched_depart_flag);\r
-       printf("arrive_time_secs %d\n", pt_head->arrive_time_secs); \r
+       printf("arrive_time_secs %d\n", pt_head->arrive_time_secs);\r
        printf("depart_time_secs %d\n", pt_head->depart_time_secs);\r
        printf("iunkn1 %#x=%d\n", pt_head->iunkn1, pt_head->iunkn1);\r
 //     x = pt_head->unkn_scaled_lon;\r
 //     x = x*360/0x10000;\r
 //     x = x/0x10000;\r
-       printf("scaled_lon %d gives lon %f\n", \r
+       printf("scaled_lon %d gives lon %f\n",\r
                        pt_head->scaled_lon, scaled2deg(pt_head->scaled_lon));\r
 //     x = (pt_head->unkn_scaled_lat*360/0x10000);\r
 //     x = x/0x10000;\r
-       printf("scaled_lat %d gives lat %f\n", \r
+       printf("scaled_lat %d gives lat %f\n",\r
                        pt_head->scaled_lat, scaled2deg(pt_head->scaled_lat));\r
        printf("cbtext1 %d\n",pt_head->cbtext1);\r
        printbuf((char*)pt_head, sizeof(struct f_jour_pt_head));\r
@@ -293,16 +133,16 @@ void print_f_jour_pt_tail(struct f_jour_pt_tail * pt_tail)
        printf("road_id %x=%d\n", pt_tail->road_id, pt_tail->road_id);\r
        printf("dist_along_rd_frac %lf \n",  pt_tail->dist_along_rd_frac);\r
 \r
-       printf("rd_arrive_sc_lat %d gives lat %f\n", \r
+       printf("rd_arrive_sc_lat %d gives lat %f\n",\r
                        pt_tail->rd_arrive_sc_lat, scaled2deg(pt_tail->rd_arrive_sc_lat));\r
 \r
-       printf("rd_arrive_sc_lon %d gives lat %f\n", \r
+       printf("rd_arrive_sc_lon %d gives lat %f\n",\r
                        pt_tail->rd_arrive_sc_lon, scaled2deg(pt_tail->rd_arrive_sc_lon));\r
 \r
-       printf("rd_depart_sc_lat %d gives lat %f\n", \r
+       printf("rd_depart_sc_lat %d gives lat %f\n",\r
                        pt_tail->rd_depart_sc_lat, scaled2deg(pt_tail->rd_depart_sc_lat));\r
 \r
-       printf("rd_depart_sc_lon %d gives lat %f\n", \r
+       printf("rd_depart_sc_lon %d gives lat %f\n",\r
                        pt_tail->rd_depart_sc_lon, scaled2deg(pt_tail->rd_depart_sc_lon));\r
 \r
        printf("iunkn8 %x=%d\n", pt_tail->iunkn8, pt_tail->iunkn8);\r
@@ -544,9 +384,9 @@ void print_annotations(struct annotations * annots)
        int i;\r
        // This is only the main stuff\r
        printf("Annotations list, version=%d, num_annotations=%d, max_annot_num=%d, stream_length=%d\n",\r
-                  annots->version, annots->num_annotations, \r
+                  annots->version, annots->num_annotations,\r
                   annots->max_annot_num, annots->stream_length);\r
-       \r
+\r
        for(i=0; i<annots->num_annotations; i++)\r
                print_annot_rec(annots->annot_list[i]);\r
 }\r
index e8fa65e5271262c1732075a89c7024a0360049eb..7a1a9619a9ceb780dab0906559230b51df3ff7bc 100644 (file)
@@ -65,10 +65,10 @@ void jour_rtept_delete(struct jour_rtept * jourpt)
 {\r
        if (jourpt==NULL)\r
                return;\r
-       xfree(jourpt->text1);\r
-       xfree(jourpt->text2);\r
+       free(jourpt->text1);\r
+       free(jourpt->text2);\r
        // This is part of an array, so free the array\r
-       //xfree(jourpt);\r
+       //free(jourpt);\r
 }\r
 \r
 struct journey * journey_new()\r
@@ -94,14 +94,14 @@ void journey_delete(struct journey * jour)
                return;\r
        for(i=0; i< jour->count_rtepts; i++)\r
                jour_rtept_delete(jour->rtept_list + i);\r
-       xfree(jour->rtept_list);\r
-       xfree(jour->avoid_os_list);\r
-       xfree(jour->buf);\r
-       xfree(jour);\r
+       free(jour->rtept_list);\r
+       free(jour->avoid_os_list);\r
+       free(jour->buf);\r
+       free(jour);\r
 }\r
 \r
 \r
-struct journey * process_journey_stream (char* jour_in_file_name, \r
+struct journey * process_journey_stream (char* jour_in_file_name,\r
                                                                                 struct pushpin_safelist * ppplist)\r
 {\r
        int j;\r
@@ -136,7 +136,7 @@ struct journey * process_journey_stream (char* jour_in_file_name,
                fprintf(stderr, "Quitting because I cannot open %s\n", jour_in_file_name);\r
                exit(1);\r
        }\r
-       \r
+\r
        bytes2read=sizeof(struct f_jour_header);\r
        jour->buf=(char*)xmalloc(jour->buf_len+bytes2read);\r
        status = readbytes(jour_in_file, jour->buf, bytes2read);\r
@@ -196,7 +196,7 @@ struct journey * process_journey_stream (char* jour_in_file_name,
                        memcpy(jour->rtept_list[j].text1, jour->buf + jour->buf_len, bytes2read);\r
                        jour->rtept_list[j].text1[bytes2read]=0;\r
                        jour->buf_len += bytes2read;\r
-               \r
+\r
                        str2ascii(jour->rtept_list[j].text1);\r
                }\r
                if (opts.explore_flag)\r
@@ -274,23 +274,23 @@ struct journey * process_journey_stream (char* jour_in_file_name,
                                lat=jour->rtept_list[j].pushpin->lat;\r
                                lon=jour->rtept_list[j].pushpin->lon;\r
 \r
-                               printf("Matching pushpin Grid %#x=%d, Precision %#x=%d, MOBBId %#x=%d\n", \r
-                                               jour->rtept_list[j].pushpin->Grid, \r
-                                               jour->rtept_list[j].pushpin->Grid, \r
-                                               jour->rtept_list[j].pushpin->Precision, \r
-                                               jour->rtept_list[j].pushpin->Precision, \r
-                                               jour->rtept_list[j].pushpin->MOBBId, \r
+                               printf("Matching pushpin Grid %#x=%d, Precision %#x=%d, MOBBId %#x=%d\n",\r
+                                               jour->rtept_list[j].pushpin->Grid,\r
+                                               jour->rtept_list[j].pushpin->Grid,\r
+                                               jour->rtept_list[j].pushpin->Precision,\r
+                                               jour->rtept_list[j].pushpin->Precision,\r
+                                               jour->rtept_list[j].pushpin->MOBBId,\r
                                                jour->rtept_list[j].pushpin->MOBBId);\r
 \r
-                               printf("Matching pushpin Lat %f Lon %f\n", \r
-                                               jour->rtept_list[j].pushpin->lat, \r
+                               printf("Matching pushpin Lat %f Lon %f\n",\r
+                                               jour->rtept_list[j].pushpin->lat,\r
                                                jour->rtept_list[j].pushpin->lon);\r
 \r
                                x = cos(lon*M_PI/180)*cos(lat*M_PI/180);\r
                                y = sin(lon*M_PI/180)*cos(lat*M_PI/180);\r
                                z = sin(lat*M_PI/180);\r
 \r
-                               printf("For matching pushpin X=%f Y=%f Z=%f\n", x,y,z); \r
+                               printf("For matching pushpin X=%f Y=%f Z=%f\n", x,y,z);\r
                        }\r
 */\r
                }\r
@@ -347,7 +347,7 @@ struct journey * process_journey_stream (char* jour_in_file_name,
                jour->buf=(char*)xrealloc(jour->buf, jour->buf_len+bytes2read);\r
                status = readbytes(jour_in_file, jour->buf + jour->buf_len, bytes2read);\r
                if (status!=bytes2read)\r
-               {                       \r
+               {\r
                        printf("Unexpected EOF in the Journey stream, options eur10\n");\r
                    fclose(jour_in_file);\r
                        return jour;\r
index df17bb6f45626d3937513308caeb6479ca5062e6..8f27e304037ca2faf2cd6614593a9bd0fd6a31cd 100644 (file)
@@ -56,16 +56,16 @@ void pushpin_safelist_delete(struct pushpin_safelist * ppl)
        int i;\r
        if (ppl==NULL)\r
                return;\r
-       \r
+\r
        for (i=0; i<ppl->num_pushpins; i++)\r
                pushpin_delete(ppl->pushpin_list[i]);\r
-       \r
-       xfree(ppl->pushpin_list);\r
-       \r
+\r
+       free(ppl->pushpin_list);\r
+\r
        for(i=0; i<3; i++)\r
-               xfree(ppl->UDM_Data[i]);\r
+               free(ppl->UDM_Data[i]);\r
 \r
-       xfree(ppl);\r
+       free(ppl);\r
 }\r
 \r
 struct pushpin * pushpin_new()\r
@@ -86,13 +86,13 @@ void pushpin_delete(struct pushpin * pp)
 {\r
        if(pp==NULL)\r
                return;\r
-       xfree(pp->NoteShort);\r
-       xfree(pp->UdName);\r
-       xfree(pp);\r
+       free(pp->NoteShort);\r
+       free(pp->UdName);\r
+       free(pp);\r
 }\r
 \r
-struct point grid2latlon(long grid, long precision) \r
-//struct point ms2latlong(struct ms_point msp) \r
+struct point grid2latlon(long grid, long precision)\r
+//struct point ms2latlong(struct ms_point msp)\r
 {\r
 // Convert the 2 long values in UserData stream to GPS coordinates.\r
 \r
@@ -119,7 +119,7 @@ struct point grid2latlon(long grid, long precision)
                p.lon=-180;\r
                return p;\r
        }\r
-       for(i=0; i<16; i++) \r
+       for(i=0; i<16; i++)\r
        {\r
                lat_val += (lat_mask & grid) >> i;\r
                lon_val += (lon_mask & grid) >> (i+1);\r
@@ -136,7 +136,7 @@ struct point grid2latlon(long grid, long precision)
        lat_val=0;\r
        lon_val=0;\r
 \r
-       for (i=0; i<16; i++) \r
+       for (i=0; i<16; i++)\r
        {\r
                lat_val += (lat_mask & precision) >> i;\r
                lon_val += (lon_mask & precision) >> (i+1);\r
@@ -155,7 +155,7 @@ struct point grid2latlon(long grid, long precision)
        if (p.lon > 180) p.lon -= 360;\r
        if (p.lat > 180) p.lat -= 360;\r
 \r
-       if ( (p.lat > 90) || (p.lat < -90) ) \r
+       if ( (p.lat > 90) || (p.lat < -90) )\r
        {\r
                printf("Got bad lat value %f converting pushpin data, setting.\n");\r
 //             p.lat=-180;\r
@@ -184,7 +184,7 @@ struct grid_point latlon2grid(double lat, double lon) {
                msp.grid += ((mask & lon_grid_ndx) << (i+1));\r
                mask <<= 1;\r
        }\r
-       \r
+\r
        mask=1;\r
        for(i=0; i<16; i++) {\r
                msp.precision += ((mask & lat_prec_ndx) << i);\r
index b8ef5f0702bf0fd39aff377263cedb721a285438..03370643864324b6df8fe119a3cd4aa6bedc48cc 100644 (file)
@@ -57,14 +57,14 @@ typedef struct PROPERTYSETHEADER
 typedef struct FORMATIDOFFSET\r
 {\r
    FMTID     fmtid ;       // semantic name of a section\r
-   DWORD     dwOffset ;    // offset from start of whole property set \r
+   DWORD     dwOffset ;    // offset from start of whole property set\r
                            // stream to the section\r
 } FORMATIDOFFSET;\r
 \r
-typedef struct PROPERTYIDOFFSET \r
+typedef struct PROPERTYIDOFFSET\r
 {\r
     DWORD        propid;     // name of a property\r
-    DWORD        dwOffset;   // offset from the start of the section to that \r
+    DWORD        dwOffset;   // offset from the start of the section to that\r
                              // property type/value pair\r
 } PROPERTYIDOFFSET;\r
 \r
@@ -75,7 +75,7 @@ typedef struct tagPROPERTYSECTIONHEADER
     PROPERTYIDOFFSET   rgPropIDOffset[];    // Array of property locations\r
 } PROPERTYSECTIONHEADER;\r
 \r
-typedef struct SERIALIZEDPROPERTYVALUE \r
+typedef struct SERIALIZEDPROPERTYVALUE\r
 {\r
     DWORD        dwType;      // type tag\r
     BYTE        rgb[];        // the actual property value\r
@@ -84,15 +84,15 @@ typedef struct SERIALIZEDPROPERTYVALUE
 /*\r
 typedef struct tagENTRY {\r
     DWORD    propid;  // Property ID\r
-    DWORD    cb;      // Count of bytes in the string, including the null \r
+    DWORD    cb;      // Count of bytes in the string, including the null\r
                       // at the end.\r
-    char     sz[cb];  // Zero-terminated string. Code page as indicated \r
+    char     sz[cb];  // Zero-terminated string. Code page as indicated\r
                       // by property ID one.\r
     } ENTRY;\r
 \r
 typedef struct tagDICTIONARY {\r
     DWORD    cEntries;        // Count of entries in the list.\r
-    ENTRY    rgEntry[cEntries]; \r
+    ENTRY    rgEntry[cEntries];\r
     } DICTIONARY;\r
 */\r
 \r
@@ -105,9 +105,9 @@ char * fmtid2str(char * str, char * fmtid)
 // We need to be careful here to get the byte order correct.\r
 // This seems to match MS's interpretation.\r
 {\r
-       sprintf(str, "{%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x}", \r
-                                       *(unsigned long*)(fmtid), \r
-                                       *(unsigned short*)(fmtid+4), \r
+       sprintf(str, "{%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x}",\r
+                                       *(unsigned long*)(fmtid),\r
+                                       *(unsigned short*)(fmtid+4),\r
                                        *(unsigned short*)(fmtid+6),\r
                                        *(unsigned char*)(fmtid+8),\r
                                        *(unsigned char*)(fmtid+9),\r
@@ -123,11 +123,11 @@ char * fmtid2str(char * str, char * fmtid)
 \r
 struct ole_property_set * ole_property_set_new(int cProps)\r
 {\r
-       struct ole_property_set * props \r
-               =(struct ole_property_set*)xmalloc(sizeof(struct ole_property_set)); \r
+       struct ole_property_set * props\r
+               =(struct ole_property_set*)xmalloc(sizeof(struct ole_property_set));\r
        props->cProps = cProps;\r
-       props->dict=NULL; \r
-       props->pPropList = (struct ole_property*)xmalloc(cProps*sizeof(struct ole_property)); \r
+       props->dict=NULL;\r
+       props->pPropList = (struct ole_property*)xmalloc(cProps*sizeof(struct ole_property));\r
        return props;\r
 }\r
 \r
@@ -140,19 +140,19 @@ void ole_property_set_delete(struct ole_property_set * props)
 \r
        for(i=0; i<props->cProps; i++)\r
        {\r
-               xfree(props->pPropList[i].buf);\r
+               free(props->pPropList[i].buf);\r
                // FIXME who owns this memory? Cant free it if it is a pointer into another buff\r
-               //xfree(props->pPropList[i]);\r
+               //free(props->pPropList[i]);\r
        }\r
 \r
        if (props->dict != NULL)\r
        {\r
-               xfree(props->dict->ent_propid);\r
-               xfree(props->dict->ent_sz);\r
-               xfree(props->dict);\r
+               free(props->dict->ent_propid);\r
+               free(props->dict->ent_sz);\r
+               free(props->dict);\r
        }\r
-       xfree(props->pPropList);\r
-       xfree(props);\r
+       free(props->pPropList);\r
+       free(props);\r
 }\r
 \r
 \r
@@ -173,9 +173,9 @@ struct dictionary * read_dictionary(int ents, char* buf, int bufsize)
                if (bytes_read>bufsize)\r
                {\r
                        printf("read past end of buffer while reading properties dictionary\n");\r
-                       xfree(dict->ent_propid);\r
-                       xfree(dict->ent_sz);\r
-                       xfree(dict);\r
+                       free(dict->ent_propid);\r
+                       free(dict->ent_sz);\r
+                       free(dict);\r
                        return NULL;\r
                }\r
 \r
@@ -191,10 +191,10 @@ struct dictionary * read_dictionary(int ents, char* buf, int bufsize)
                {\r
                        printf("reading dictionary, read entry for propid %#x with name length %d > max allowed length of 128\n",\r
                                dict->ent_propid[ent_read], this_ent_cb);\r
-//                     xfree(dict->ent_cb);\r
-                       xfree(dict->ent_propid);\r
-                       xfree(dict->ent_sz);\r
-                       xfree(dict);\r
+//                     free(dict->ent_cb);\r
+                       free(dict->ent_propid);\r
+                       free(dict->ent_sz);\r
+                       free(dict);\r
                        return NULL;\r
                }\r
 \r
@@ -227,7 +227,7 @@ unsigned int get_dict_entry(struct dictionary* dict, DWORD propid)
 struct ole_property * get_propterty(struct ole_property_set * props, DWORD propid)\r
 {\r
        unsigned int i;\r
-       \r
+\r
        if (props==NULL)\r
                return NULL;\r
 \r
@@ -262,8 +262,8 @@ void print_ole_properties(struct ole_property_set * props)
                if (dict_ent != -1)\r
                        name = props->dict->ent_sz[dict_ent];\r
 \r
-               wprintf(L"\nproperty %d: has name %s propid %#x, type %#x, and length %d bytes\n", \r
-                               i, name, props->pPropList[i].propid, \r
+               wprintf(L"\nproperty %d: has name %s propid %#x, type %#x, and length %d bytes\n",\r
+                               i, name, props->pPropList[i].propid,\r
                                props->pPropList[i].dwType, props->pPropList[i].buflen );\r
 \r
                switch(props->pPropList[i].propid)\r
@@ -276,18 +276,18 @@ void print_ole_properties(struct ole_property_set * props)
                                wprintf(L"%#x   %s\n", props->dict->ent_propid[j], (props->dict->ent_sz[j]));\r
                        break;\r
                case 1:\r
-                       printf("This specifies codepage %d (1200=Unicode, 1252=Ansi).\n", \r
+                       printf("This specifies codepage %d (1200=Unicode, 1252=Ansi).\n",\r
                                        *(USHORT*)(props->pPropList[i].buf) );\r
                        break;\r
                case 0x80000000:\r
-                       printf("This specifies locale %d .\n", \r
+                       printf("This specifies locale %d .\n",\r
                                        *(unsigned short*)(props->pPropList[i].buf) );\r
                        break;\r
                default:\r
                        switch(props->pPropList[i].dwType)\r
                        {\r
                        case VT_BSTR: //=8\r
-                       //  the prefix bytecount is still there \r
+                       //  the prefix bytecount is still there\r
                                wprintf(L"This has value '%ls'\n", props->pPropList[i].buf+4);\r
                                break;\r
                        case VT_UNKNOWN: //=13\r
@@ -339,7 +339,7 @@ struct ole_property_set * read_ole_properties2(char* prop_file_name)
        status=readbytes(prop_file, (char*)prop_header, sizeof(PROPERTYSETHEADER));\r
        status=readbytes(prop_file, (char*)fmt_id_os, sizeof(FORMATIDOFFSET));\r
 \r
-       if ( (prop_header->wByteOrder != 0xFFFE) || (prop_header->wFormat != 0) \r
+       if ( (prop_header->wByteOrder != 0xFFFE) || (prop_header->wFormat != 0)\r
                 || (prop_header->dwReserved != 1)  || (fmt_id_os->dwOffset !=0x30) )\r
        {\r
                printf("Not a valid properties set header in file %s\n", prop_file_name);\r
@@ -352,7 +352,7 @@ struct ole_property_set * read_ole_properties2(char* prop_file_name)
        psect_header = (PROPERTYSECTIONHEADER *)xrealloc(psect_header, psect_header->cbSection);\r
        section_buff = (char*)psect_header;\r
 \r
-       status=readbytes(prop_file, (char*)(psect_header->rgPropIDOffset), \r
+       status=readbytes(prop_file, (char*)(psect_header->rgPropIDOffset),\r
                                                psect_header->cbSection - sizeof(PROPERTYSECTIONHEADER));\r
 \r
        property_set = ole_property_set_new(psect_header->cProperties);\r
@@ -382,8 +382,8 @@ struct ole_property_set * read_ole_properties2(char* prop_file_name)
        for (i=0; i< psect_header->cProperties; i++)\r
        {\r
                property_set->pPropList[i].propid = psect_header->rgPropIDOffset[i].propid;\r
-               \r
-//             property_set->pPropList[i].buf \r
+\r
+//             property_set->pPropList[i].buf\r
 //                     = section_buff + psect_header->rgPropIDOffset[i].dwOffset  + 4;\r
 \r
                property_set->pPropList[i].buf = (char*)xmalloc(property_set->pPropList[i].buflen);\r
@@ -396,16 +396,16 @@ struct ole_property_set * read_ole_properties2(char* prop_file_name)
 \r
        for (i=0; i< property_set->cProps; i++)\r
                if (property_set->pPropList[i].propid==0)\r
-                       property_set->dict=read_dictionary(property_set->pPropList[i].dwType, \r
-                                                               property_set->pPropList[i].buf, \r
+                       property_set->dict=read_dictionary(property_set->pPropList[i].dwType,\r
+                                                               property_set->pPropList[i].buf,\r
                                                                property_set->pPropList[i].buflen);\r
 \r
        fclose(prop_file);\r
-       xfree(prop_header);\r
-       xfree(psect_header);\r
-       xfree(fmt_id_os);\r
+       free(prop_header);\r
+       free(psect_header);\r
+       free(fmt_id_os);\r
 \r
-       return property_set;    \r
+       return property_set;\r
 }\r
 \r
 struct ole_property_set * read_ole_properties(char* source_file_name, char* properties_file_name)\r
@@ -413,13 +413,13 @@ struct ole_property_set * read_ole_properties(char* source_file_name, char* prop
        char * prop_file_name;\r
        struct ole_property_set * strips_property_set=NULL;\r
        struct ole_property_set * summary_property_set=NULL;\r
-       \r
+\r
        if ( (source_file_name==NULL) && (properties_file_name==NULL) )\r
                return NULL;\r
 \r
        if (source_file_name!=NULL)\r
                prop_file_name = (char*)xmalloc(strlen(source_file_name)+40);\r
-       else \r
+       else\r
                prop_file_name = properties_file_name;\r
 \r
        strcpy(prop_file_name, source_file_name);\r
@@ -445,7 +445,7 @@ struct ole_property_set * read_ole_properties(char* source_file_name, char* prop
 \r
        debug_pause();\r
 \r
-       xfree(prop_file_name);\r
+       free(prop_file_name);\r
        ole_property_set_delete(summary_property_set);\r
 \r
        return strips_property_set;\r
index e9da430d319318a0c8a37274bef6042512530365..c6e0ccf7d806e86c61ad0b62b321ad68a5f42aa9 100644 (file)
@@ -44,7 +44,7 @@ static int cdata_length;
 \r
 //FILE* gpx_in_file=NULL;\r
 \r
-char * gpx_elem_name[] = \r
+char * gpx_elem_name[] =\r
 {\r
        "unknown-element",\r
        "wpt",\r
@@ -74,9 +74,9 @@ void gpxpt_delete(struct gpxpt * pt)
 {\r
        if(pt==NULL)\r
                return;\r
-       xfree(pt->name);\r
-       xfree(pt->desc);\r
-       xfree(pt);\r
+       free(pt->name);\r
+       free(pt->desc);\r
+       free(pt);\r
 }\r
 \r
 struct gpxpt * gpxpt_copy(struct gpxpt * otherpt)\r
@@ -122,9 +122,9 @@ void gpxrte_delete(struct gpxrte * rte)
                return;\r
        for (i=0; i<rte->rtept_list_count; i++)\r
                gpxpt_delete(rte->rtept_list[i]);\r
-       xfree(rte->rtept_list);\r
-       xfree(rte->name);\r
-       xfree(rte);\r
+       free(rte->rtept_list);\r
+       free(rte->name);\r
+       free(rte);\r
 }\r
 \r
 struct gpxtrk * gpxtrk_new()\r
@@ -142,8 +142,8 @@ void gpxtrk_delete(struct gpxtrk * trk)
                return;\r
        for (i=0; i<trk->trkpt_list_count; i++)\r
                gpxpt_delete(trk->trkpt_list[i]);\r
-       xfree(trk->trkpt_list);\r
-       xfree(trk);\r
+       free(trk->trkpt_list);\r
+       free(trk);\r
 }\r
 \r
 struct gpx_data * gpx_data_new()\r
@@ -165,17 +165,17 @@ void gpx_data_delete(struct gpx_data * data)
        if(data==NULL)\r
                return;\r
 \r
-       xfree(data->data_source_name);\r
+       free(data->data_source_name);\r
        for (i=0; i<data->wpt_list_count; i++)\r
                gpxpt_delete(data->wpt_list[i]);\r
        for (i=0; i<data->rte_list_count; i++)\r
                gpxrte_delete(data->rte_list[i]);\r
        for (i=0; i<data->trk_list_count; i++)\r
                gpxtrk_delete(data->trk_list[i]);\r
-       xfree(data->wpt_list);\r
-       xfree(data->rte_list);\r
-       xfree(data->trk_list);\r
-       xfree(data);\r
+       free(data->wpt_list);\r
+       free(data->rte_list);\r
+       free(data->trk_list);\r
+       free(data);\r
 }\r
 \r
 void print_wptlist(struct gpxpt ** wpt_list, int wpt_list_count)\r
@@ -183,7 +183,7 @@ void print_wptlist(struct gpxpt ** wpt_list, int wpt_list_count)
        int i;\r
        printf("Global waypoints:\n");\r
        for (i=0; i<wpt_list_count; i++)\r
-               printf("wpt: lat=%f, lon=%f, name='%s', desc='%s'\n", \r
+               printf("wpt: lat=%f, lon=%f, name='%s', desc='%s'\n",\r
                                wpt_list[i]->lat, wpt_list[i]->lon, wpt_list[i]->name, wpt_list[i]->desc);\r
 }\r
 \r
@@ -192,7 +192,7 @@ void print_route(struct gpxrte * rte)
        int i;\r
        printf("Route '%s' with %d route-points:\n", rte->name, rte->rtept_list_count);\r
        for (i=0; i<rte->rtept_list_count; i++)\r
-               printf("rtept: lat=%f, lon=%f, name='%s', desc='%s'\n", \r
+               printf("rtept: lat=%f, lon=%f, name='%s', desc='%s'\n",\r
                                (rte->rtept_list)[i]->lat, (rte->rtept_list)[i]->lon,\r
                                (rte->rtept_list)[i]->name, (rte->rtept_list)[i]->desc);\r
 }\r
@@ -210,7 +210,7 @@ void print_track(struct gpxtrk * trk)
        int i;\r
        printf("Track with %d track-points:\n", trk->trkpt_list_count);\r
        for (i=0; i<trk->trkpt_list_count; i++)\r
-               printf("trkpt: lat=%f, lon=%f\n", \r
+               printf("trkpt: lat=%f, lon=%f\n",\r
                                trk->trkpt_list[i]->lat, trk->trkpt_list[i]->lon);\r
 }\r
 \r
@@ -230,10 +230,10 @@ void print_gpx_data(struct gpx_data * all_data)
 }\r
 \r
 char* get_att(char* match, const char **atts)\r
-{                \r
+{\r
        const char **avp = &atts[0];\r
-       while (*avp) { \r
-               if (strcmp(avp[0], match) == 0) \r
+       while (*avp) {\r
+               if (strcmp(avp[0], match) == 0)\r
                        return (char *)avp[1];\r
                avp+=2;\r
        }\r
@@ -325,7 +325,7 @@ void startrtept(void *userData, const char *name, const char **atts)
        }\r
        current_main_element=GPX_ELEM_TYPE_RTEPT;\r
 \r
-       thisrte->rtept_list=(struct gpxpt **)xrealloc(thisrte->rtept_list, \r
+       thisrte->rtept_list=(struct gpxpt **)xrealloc(thisrte->rtept_list,\r
                                                                                                (thisrte->rtept_list_count+1)*sizeof(struct gpxpt *));\r
        thisrte->rtept_list[thisrte->rtept_list_count] = gpxpt_new();\r
        sscanf(get_att("lat", atts), "%lf", &(thisrte->rtept_list[thisrte->rtept_list_count]->lat));\r
@@ -373,9 +373,9 @@ void endtrk(void *userData, const char *name)
        }\r
        current_main_element=0;\r
 \r
-//     printf("read end of track%d, with %d points\n", \r
+//     printf("read end of track%d, with %d points\n",\r
 //                     dat->trk_list_count,\r
-//                     dat->trk_list[dat->trk_list_count-1]->trkpt_list_count); \r
+//                     dat->trk_list[dat->trk_list_count-1]->trkpt_list_count);\r
 }\r
 \r
 // just eat <trkseg>: we join all track segments as a single track\r
@@ -415,7 +415,7 @@ void starttrkpt(void *userData, const char *name, const char **atts)
        }\r
        current_main_element=GPX_ELEM_TYPE_TRKPT;\r
 \r
-       thistrk->trkpt_list=(struct gpxpt **)xrealloc(thistrk->trkpt_list, \r
+       thistrk->trkpt_list=(struct gpxpt **)xrealloc(thistrk->trkpt_list,\r
                                                                                                (thistrk->trkpt_list_count+1)*sizeof(struct gpxpt *));\r
        thistrk->trkpt_list[thistrk->trkpt_list_count]=gpxpt_new();\r
        sscanf(get_att("lat", atts), "%lf", &(thistrk->trkpt_list[thistrk->trkpt_list_count]->lat));\r
@@ -468,7 +468,7 @@ void endname(void *userData, const char *name)
                //break;\r
        case GPX_ELEM_TYPE_TRKPT:\r
        default:\r
-               xfree(nameval);\r
+               free(nameval);\r
                break;\r
        }\r
 }\r
@@ -508,7 +508,7 @@ void enddesc(void *userData, const char *name)
 //             break;\r
        case GPX_ELEM_TYPE_TRKPT:\r
        default:\r
-               xfree(desc);\r
+               free(desc);\r
                break;\r
        }\r
 }\r
@@ -523,7 +523,7 @@ void endsrc(void *userData, const char *name)
 \r
 #define GPX_NUM_ELEM_HANDLERS 10\r
 \r
-gpx_elm_start_handler gpx_start_elm_handler[] = \r
+gpx_elm_start_handler gpx_start_elm_handler[] =\r
 {\r
        &startunkn,\r
        &startwpt,\r
@@ -537,7 +537,7 @@ gpx_elm_start_handler gpx_start_elm_handler[] =
        &startsrc\r
 };\r
 \r
-gpx_elm_end_handler gpx_end_elm_handler[] = \r
+gpx_elm_end_handler gpx_end_elm_handler[] =\r
 {\r
        &endunkn,\r
        &endwpt,\r
@@ -567,7 +567,7 @@ startElement(void *userData, const char *name, const char **atts)
        int i = get_gpx_type_ndx(name);\r
        gpx_start_elm_handler[i](userData, name, atts);\r
 \r
-       xfree(cdata);\r
+       free(cdata);\r
        cdata=NULL;\r
        cdata_length=0;\r
 \r
@@ -623,7 +623,7 @@ struct gpx_data * process_gpx_in_file(char* gpx_in_file_name)
                printf("Importing data from %s\n", gpx_in_file_name);\r
                gpx_in_file = fopen(gpx_in_file_name, "r");\r
        }\r
\r
+\r
        if(gpx_in_file==NULL)\r
        {\r
                fprintf(stderr, "Unable to open GPX file %s\n", gpx_in_file_name);\r
@@ -631,11 +631,11 @@ struct gpx_data * process_gpx_in_file(char* gpx_in_file_name)
                exit(1);\r
        }\r
 \r
-       do \r
+       do\r
        {\r
                size_t len = fread(buf, 1, sizeof(buf), gpx_in_file);\r
                done = len < sizeof(buf);\r
-               if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR) \r
+               if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR)\r
                {\r
                        fprintf(stderr,\r
                                "%s at line %d\n",\r
@@ -650,7 +650,7 @@ struct gpx_data * process_gpx_in_file(char* gpx_in_file_name)
        {\r
        }\r
 \r
-       xfree(cdata);\r
+       free(cdata);\r
 \r
        return all_data;\r
 }\r
index cc4bd200139ef23a25ab44b17af339cfb3fe1b4c..864980ed88b9cd8015bcdd4857e0e06bb078139e 100644 (file)
@@ -57,11 +57,7 @@ void * xmalloc(size_t size)
                debug_pause();\r
                exit(-1);\r
        }\r
-//#ifdef   _DEBUG\r
-//     obj = _malloc_dbg(size, _NORMAL_BLOCK, __FILE__, __LINE__ );\r
-//#else\r
        obj = malloc(size);\r
-//#endif\r
        if (!obj)\r
        {\r
                fprintf(stderr, "Unable to allocate %d bytes of memory.\n", size);\r
@@ -69,12 +65,6 @@ void * xmalloc(size_t size)
                exit(-1);\r
        }\r
 \r
-#ifdef _DEBUG\r
-#ifdef MEMTRACE\r
-       printf("Malloc'd %d bytes at %lx\n", size, obj);\r
-#endif\r
-#endif\r
-\r
        return obj;\r
 }\r
 \r
@@ -88,17 +78,7 @@ void * xrealloc(void* ptr, size_t size)
                exit(-1);\r
        }\r
 \r
-#ifdef _DEBUG\r
-#ifdef MEMTRACE\r
-       printf("reallocing from %lx\n", ptr);\r
-#endif\r
-#endif\r
-\r
-//#ifdef   _DEBUG\r
-//     obj = _realloc_dbg(ptr, size, _NORMAL_BLOCK, __FILE__, __LINE__ );\r
-//#else\r
        obj = realloc(ptr, size);\r
-//#endif\r
        if (!obj)\r
        {\r
                fprintf(stderr, "Unable to (re)allocate %d bytes of memory.\n", size);\r
@@ -106,31 +86,9 @@ void * xrealloc(void* ptr, size_t size)
                exit(-1);\r
        }\r
 \r
-#ifdef _DEBUG\r
-#ifdef MEMTRACE\r
-       printf("realloc'd %d bytes at %lx\n", size, obj);\r
-#endif\r
-#endif\r
-\r
        return obj;\r
 }\r
 \r
-void xfree(void * obj)\r
-{\r
-//#ifdef   _DEBUG\r
-//     _free_dbg(obj, _NORMAL_BLOCK);\r
-//#else\r
-\r
-#ifdef _DEBUG\r
-#ifdef MEMTRACE\r
-       printf("freeing mem at %lx\n", obj);\r
-#endif\r
-#endif\r
-\r
-       free(obj);\r
-// #endif\r
-}\r
-\r
 char * str2ascii(char* str)\r
 {\r
        int i;\r
@@ -147,7 +105,7 @@ char * str2ascii(char* str)
 }\r
 \r
 char * strappend(char* str1, char* str2)\r
-// create a new string \r
+// create a new string\r
 {\r
        int len1=strlen(str1);\r
        int len2=strlen(str2);\r
@@ -256,12 +214,10 @@ main(int argc, char** argv)
        struct gpx_data* all_gpx=NULL;\r
        struct ole_property_set * strips_properties=NULL;\r
        struct ole_property * prop = NULL;\r
-       struct contents * conts;\r
+       struct contents * conts=NULL;\r
 \r
        char* temp_str=NULL;\r
 \r
-//     int verify_eof_flag = 0;\r
-\r
        opts.explore_flag=0;\r
        opts.use_gpx_route=0;\r
        opts.verbose_flag=2;\r
@@ -274,11 +230,11 @@ main(int argc, char** argv)
 #ifdef MEMCHK\r
        // Call _CrtCheckMemory at every allocation and deallocation request.\r
        SET_CRT_DEBUG_FIELD(_CRTDBG_CHECK_ALWAYS_DF);\r
-       // Keep freed memory blocks in the heaps linked list, assign them the _FREE_BLOCK type, \r
+       // Keep freed memory blocks in the heaps linked list, assign them the _FREE_BLOCK type,\r
        // and fill them with the byte value 0xDD.\r
        SET_CRT_DEBUG_FIELD(_CRTDBG_DELAY_FREE_MEM_DF);\r
-       // Perform automatic leak checking at program exit via a call to _CrtDumpMemoryLeaks \r
-       // and generate an error report if the application failed to free all the memory \r
+       // Perform automatic leak checking at program exit via a call to _CrtDumpMemoryLeaks\r
+       // and generate an error report if the application failed to free all the memory\r
        // it allocated.\r
        SET_CRT_DEBUG_FIELD(_CRTDBG_LEAK_CHECK_DF);\r
 #endif\r
@@ -488,9 +444,9 @@ main(int argc, char** argv)
                if (all_gpx==NULL)\r
                        printf("Didn't read any usable data from %s ???\n",mpst_in_file_name);\r
                printf("Read %d waypoints, %d routes and %d tracks from file %s\n",\r
-                               all_gpx->wpt_list_count, all_gpx->rte_list_count, \r
+                               all_gpx->wpt_list_count, all_gpx->rte_list_count,\r
                                all_gpx->trk_list_count, mpst_in_file_name);\r
-               printf("Importing this data as %d lines\n", \r
+               printf("Importing this data as %d lines\n",\r
                                all_gpx->rte_list_count + all_gpx->trk_list_count);\r
        }\r
 \r
@@ -501,13 +457,13 @@ main(int argc, char** argv)
                prop = get_propterty(strips_properties, 0x60002);\r
                if ((prop!=NULL) && (prop->buf != NULL) )\r
                {\r
-                       opts.st_version_num = *(int*)(prop->buf); \r
+                       opts.st_version_num = *(int*)(prop->buf);\r
                        printf("Autoroute/S&T version in %s is %d\n", opts.source_file_name, opts.st_version_num);\r
                }\r
                prop = get_propterty(strips_properties, 0x10000);\r
                if ((prop!=NULL) && (prop->buf != NULL) )\r
                {\r
-                       opts.MapName = (WCHAR*)(prop->buf + 4); \r
+                       opts.MapName = (WCHAR*)(prop->buf + 4);\r
                        wprintf(L"MapName is %ls\n", opts.MapName);\r
                        if(wcscmp(opts.MapName, L"USA")==0)\r
                                opts.isUSA=1;\r
@@ -518,6 +474,7 @@ main(int argc, char** argv)
 \r
        // check the contents stream\r
        //if(opts.explore_flag)\r
+       if(opts.source_file_name)\r
        {\r
                temp_str = strappend(opts.source_file_name, ".Contents\\Contents");\r
                conts = read_contents(temp_str);\r
@@ -613,18 +570,18 @@ main(int argc, char** argv)
        ole_property_set_delete(strips_properties);\r
        contents_delete(conts);\r
 \r
-       xfree(cmdpath);\r
-       xfree(ppin_in_file_name);\r
-       xfree(jour_in_file_name);\r
-       xfree(annot_in_file_name);\r
-       xfree(gpx_in_file_name);\r
-       xfree(gpx_out_file_name);\r
-       xfree(pcx5_out_file_name);\r
-       xfree(import_file_name);\r
-       xfree(opts.source_file_name);\r
-       xfree(contents_dir_name);\r
-       xfree(mpst_in_file_name);\r
-       \r
+       free(cmdpath);\r
+       free(ppin_in_file_name);\r
+       free(jour_in_file_name);\r
+       free(annot_in_file_name);\r
+       free(gpx_in_file_name);\r
+       free(gpx_out_file_name);\r
+       free(pcx5_out_file_name);\r
+       free(import_file_name);\r
+       free(opts.source_file_name);\r
+       free(contents_dir_name);\r
+       free(mpst_in_file_name);\r
+\r
        if (opts.verbose_flag>5)\r
                printf("Done freeing all\n");\r
 \r
@@ -635,7 +592,7 @@ main(int argc, char** argv)
        _flushall();\r
 \r
 #ifdef _DEBUG\r
-//     _CrtDumpMemoryLeaks();  \r
+//     _CrtDumpMemoryLeaks();\r
 #endif\r
        debug_pause();\r
 }\r
index 920d5085db391d8a7eeac5d82eb7b0f1e267a2ee..df25be3bc9e2d9d5b667e4f50fc7b7f6366ab29e 100644 (file)
@@ -42,7 +42,7 @@ RSC=rc.exe
 # PROP Ignore_Export_Lib 0\r
 # PROP Target_Dir ""\r
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
-# ADD CPP /nologo /Zp1 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /Zp1 /Za /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
 # ADD BASE RSC /l 0x409 /d "NDEBUG"\r
 # ADD RSC /l 0x409 /d "NDEBUG"\r
 BSC32=bscmake.exe\r
@@ -75,8 +75,8 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 libexpat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /pdbtype:sept\r
-# SUBTRACT LINK32 /profile /map /debug\r
+# ADD LINK32 libexpat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# SUBTRACT LINK32 /profile /map\r
 \r
 !ENDIF \r
 \r
@@ -93,10 +93,10 @@ SOURCE=.\annotations.c
 \r
 !IF  "$(CFG)" == "st2gpx - Win32 Release"\r
 \r
-# ADD CPP /Za\r
-\r
 !ELSEIF  "$(CFG)" == "st2gpx - Win32 Debug"\r
 \r
+# SUBTRACT CPP /FA<none>\r
+\r
 !ENDIF \r
 \r
 # End Source File\r
@@ -106,25 +106,16 @@ SOURCE=.\contents.c
 \r
 !IF  "$(CFG)" == "st2gpx - Win32 Release"\r
 \r
-# ADD CPP /Za\r
-\r
 !ELSEIF  "$(CFG)" == "st2gpx - Win32 Debug"\r
 \r
+# ADD CPP /Za\r
+\r
 !ENDIF \r
 \r
 # End Source File\r
 # Begin Source File\r
 \r
 SOURCE=.\debug.c\r
-\r
-!IF  "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
-# ADD CPP /Za\r
-\r
-!ELSEIF  "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-!ENDIF \r
-\r
 # End Source File\r
 # Begin Source File\r
 \r
@@ -134,41 +125,14 @@ SOURCE=.\getopt.c
 # Begin Source File\r
 \r
 SOURCE=.\journey.c\r
-\r
-!IF  "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
-# ADD CPP /Za\r
-\r
-!ELSEIF  "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-!ENDIF \r
-\r
 # End Source File\r
 # Begin Source File\r
 \r
 SOURCE=.\nannol.c\r
-\r
-!IF  "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
-# ADD CPP /Za\r
-\r
-!ELSEIF  "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-!ENDIF \r
-\r
 # End Source File\r
 # Begin Source File\r
 \r
 SOURCE=.\ppinutil.c\r
-\r
-!IF  "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
-# ADD CPP /Za\r
-\r
-!ELSEIF  "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-!ENDIF \r
-\r
 # End Source File\r
 # Begin Source File\r
 \r
@@ -178,74 +142,27 @@ SOURCE=.\properties.c
 # Begin Source File\r
 \r
 SOURCE=.\pushpins.cpp\r
-\r
-!IF  "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
 # ADD CPP /Ze\r
-\r
-!ELSEIF  "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-# ADD CPP /Ze /W4 /Gi\r
-\r
-!ENDIF \r
-\r
 # End Source File\r
 # Begin Source File\r
 \r
 SOURCE=.\readgpx.c\r
-\r
-!IF  "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
-# ADD CPP /Za\r
-\r
-!ELSEIF  "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-!ENDIF \r
-\r
 # End Source File\r
 # Begin Source File\r
 \r
 SOURCE=.\readmpst.c\r
-\r
-!IF  "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
-# ADD CPP /Za\r
-\r
-!ELSEIF  "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-!ENDIF \r
-\r
 # End Source File\r
 # Begin Source File\r
 \r
 SOURCE=.\st2gpx.c\r
-# ADD CPP /Za\r
 # End Source File\r
 # Begin Source File\r
 \r
 SOURCE=.\writegpx.c\r
-\r
-!IF  "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
-# ADD CPP /Za\r
-\r
-!ELSEIF  "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-!ENDIF \r
-\r
 # End Source File\r
 # Begin Source File\r
 \r
 SOURCE=.\writepcx.c\r
-\r
-!IF  "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
-# ADD CPP /Za\r
-\r
-!ELSEIF  "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-!ENDIF \r
-\r
 # End Source File\r
 # End Group\r
 # Begin Group "Header Files"\r
@@ -306,6 +223,14 @@ SOURCE=.\history.txt
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=.\msado15.tlh\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\msado15.tli\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=.\ToDo.txt\r
 # End Source File\r
 # End Target\r
index 03e7fe178a6fcb2181f57e6ef1052b4d96529a19..3738383de220eebedca67ced1c7e8a8bcecb3d6f 100644 (file)
@@ -30,7 +30,6 @@ extern "C" {
 
 //#define MEMCHK
 //#define DEBUG_STDOUT
-//#define MEMTRACE
 
 #ifdef _DEBUG
 #define _CRTDBG_MAP_ALLOC
@@ -99,7 +98,6 @@ extern struct contents;
 extern struct st2gpx_options opts;
 void * xmalloc(size_t size);
 void * xrealloc(void* ptr, size_t size);
-void xfree(void * obj);
 char * str2ascii(char* str);
 int readbytes(FILE* file, char* buf, int bytes2read);
 //nannol.c
index 34bbcdf232338a0b52f4fbfe7a7d705f042befad..b61d88aa693116d2d00b04c6c4f110fd62c801d1 100644 (file)
@@ -139,7 +139,7 @@ void gpx_write_jour_point(FILE* gpx_out_file, struct journey * jour, struct jour
        gpx_write_point(gpx_out_file, pt, GPX_RTEPT, opt_elms);\r
 \r
        gpxpt_delete(pt);\r
-       xfree(opt_elms);\r
+       free(opt_elms);\r
 }\r
 \r
 void gpx_write_jour_header(FILE* gpx_out_file)\r
@@ -191,7 +191,7 @@ void gpx_write_pushpinlist (FILE* gpx_out_file, struct pushpin_safelist *ppplist
                if (ppplist->pushpin_list[i]==NULL)\r
                        break;\r
 \r
-               optlen = strlen(ppplist->pushpin_list[i]->UdName) \r
+               optlen = strlen(ppplist->pushpin_list[i]->UdName)\r
                                + strlen(ppplist->pushpin_list[i]->NoteShort) + 60;\r
                opt_elms = (char*)xmalloc(optlen);\r
 \r
@@ -202,7 +202,7 @@ void gpx_write_pushpinlist (FILE* gpx_out_file, struct pushpin_safelist *ppplist
                pt->lon = ppplist->pushpin_list[i]->lon;\r
 \r
                gpx_write_point(gpx_out_file, pt, GPX_WPT, opt_elms);\r
-               xfree(opt_elms);\r
+               free(opt_elms);\r
        }\r
        fprintf(gpx_out_file, "\n");\r
        gpxpt_delete(pt);\r
@@ -300,8 +300,8 @@ void gpx_write_annotations(FILE* gpx_out_file, struct annotations * annots)
                }\r
 }\r
 \r
-void gpx_write_all(char* gpx_out_file_name, \r
-                                  struct pushpin_safelist *ppplist, \r
+void gpx_write_all(char* gpx_out_file_name,\r
+                                  struct pushpin_safelist *ppplist,\r
                                   struct journey * jour,\r
                                   struct annotations * annots)\r
 {\r
index 89ae0f03b6b933a7046fce132e4e4a86f3479679..35e54b6e64e67abbe7bbee8a43fb9303e2d9573f 100644 (file)
@@ -86,7 +86,7 @@ void garmin_ident_crush(char* str)
        str[6]=0;\r
 }\r
 \r
-void comp_mk_uniq_idents(char* ident_array, int ident_to_mk_uniq, int count_idents) \r
+void comp_mk_uniq_idents(char* ident_array, int ident_to_mk_uniq, int count_idents)\r
 // compare ident_to_mk_uniq-th ident to all preceding idents,\r
 // and make ident_to_mk_uniq-th ident\r
 {\r
@@ -161,7 +161,7 @@ void make_uniq_idents(struct pushpin_safelist * ppplist, struct journey * jour)
        }\r
        else\r
                count_ppins=ppplist->num_pushpins;\r
-       \r
+\r
        ident_array=(char*)xmalloc(7*(count_ppins + jour->count_rtepts));\r
 \r
        // copy ppin names before we start mangling them\r
@@ -180,8 +180,8 @@ void make_uniq_idents(struct pushpin_safelist * ppplist, struct journey * jour)
        // copy rtept names before we start mangling them\r
        for (i=0; i< (jour->count_rtepts); i++)\r
        {\r
-               memcpy(ident_array + 7*(count_ppins) +7*i, \r
-                          jour->rtept_list[i].text1, \r
+               memcpy(ident_array + 7*(count_ppins) +7*i,\r
+                          jour->rtept_list[i].text1,\r
                           6);\r
                garmin_ident_crush(ident_array + 7*(count_ppins) + 7*i);\r
        }\r
@@ -193,7 +193,7 @@ void make_uniq_idents(struct pushpin_safelist * ppplist, struct journey * jour)
                // Create a unique ident if neccesary.\r
                // Only check against list of already-verified unique\r
                comp_mk_uniq_idents(ident_array, i, count_ppins + jour->count_rtepts);\r
-               \r
+\r
                strncpy(ppplist->pushpin_list[i]->garmin_ident, ident_array+7*i, 7);\r
        }\r
 \r
@@ -225,24 +225,24 @@ void make_uniq_idents(struct pushpin_safelist * ppplist, struct journey * jour)
                                                   ppplist->pushpin_list[j]->garmin_ident,\r
                                                   7);\r
                                        // Although the journey stream doesn't associate this pushpin with the route,\r
-                                       // I have decided to. Again, this is questionable \r
+                                       // I have decided to. Again, this is questionable\r
                                        // but not likely to happen anyway.\r
                                        jour->rtept_list[i].pushpin = ppplist->pushpin_list[j];\r
                                }\r
                                else\r
                                {\r
                                        // no matching wpt for this rtept, so we need to create one.\r
-                                       // We just create the garmin_ident in the jour-rtept here, \r
+                                       // We just create the garmin_ident in the jour-rtept here,\r
                                        // later we will write a corresponding wpt to the pcx file.\r
                                        comp_mk_uniq_idents(ident_array, count_ppins + i, count_ppins + jour->count_rtepts);\r
-                               }                               \r
+                               }\r
                }\r
                // set the jour-rtept garmin_ident\r
                memcpy(jour->rtept_list[i].garmin_ident,\r
                           ident_array + 7*(count_ppins) +7*i,\r
                           7);\r
        }\r
-       xfree(ident_array);\r
+       free(ident_array);\r
 }\r
 \r
 void gar_write_header(FILE* gar_out_file)\r
@@ -352,18 +352,18 @@ void pcx5_write_jour_pt(FILE* file, struct journey * jour, struct jour_rtept * r
 \r
                memcpy(desc, rtept->text1,39);\r
                strpad(desc, 40);\r
-               \r
-               pcx5_write_pt(file, \r
-                                         pt_type, \r
-                                         rtept->garmin_ident, \r
-                                         scaled2deg(f_wpt_head->scaled_lat), \r
-                                         scaled2deg(f_wpt_head->scaled_lon), \r
-                                         timedate,     \r
-                                         alt, \r
-                                         desc, \r
-                                         proximity, \r
+\r
+               pcx5_write_pt(file,\r
+                                         pt_type,\r
+                                         rtept->garmin_ident,\r
+                                         scaled2deg(f_wpt_head->scaled_lat),\r
+                                         scaled2deg(f_wpt_head->scaled_lon),\r
+                                         timedate,\r
+                                         alt,\r
+                                         desc,\r
+                                         proximity,\r
                                          symbol);\r
-               \r
+\r
 //     }\r
 //     else if(pt_type==GAR_RTE)\r
 //     {\r